package cc.rboot.feature.core;

public abstract class AbstractFeatureResolver implements IFeatureResolver {

    @Override
    public boolean check(FeatureMethodEnum symbol, String[] conditions) {
        switch (symbol) {
            case EQUALS:
                return this.equals(conditions[0]);
            case GREATER_THAN:
                return this.greaterThan(conditions[0]);
            case LESS_THAN:
                return this.lessThan(conditions[0]);
            case GREATER_THAN_OR_EQUALS:
                return this.greaterThan(conditions[0]) || this.equals(conditions[0]);
            case LESS_THAN_OR_EQUALS:
                return this.lessThan(conditions[0]) || this.equals(conditions[0]);
            case BETWEEN:
                return conditions.length == 2 && this.between(conditions);
            case IN:
                return this.in(conditions);
            case NOT_IN:
                return this.notIn(conditions);
        }
        return false;
    }
}
